package com.ruoyi.manage.domain;

import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;

/**
 * 机构管理1对象 sys_mechanism
 *
 * @author ruoyi
 * @date 2022-11-08
 */
public class SysMechanism extends BaseEntity {
    private static final long serialVersionUID = 1L;

    private List<SysMechanism> children;

    private final String random = UUID.randomUUID().toString();

    /**
     * $column.columnComment
     */
    private Long id;

    /**
     * 机构编号
     */
    @Excel(name = "机构编号")
    private String mechanismCode;

    /**
     * 机构名称
     */
    @Excel(name = "机构名称")
    private String mechanismName;

    /**
     * 机构名称
     */
    @Excel(name = "上级机构")
    private String parentMechanismName;

    private Long parentLevelId;

    /**
     * 级别id
     */
    @Excel(name = "级别id")
    private Long levelId;

    /**
     * 级别颜色
     */
    private Map<String, String> map;

    @Excel(name = "级别名称")
    private String levelName;

    @Excel(name = "所在区域")
    private String region;

    private Map<String,String> address;

    /**
     * 行政区划编码
     */
    @Excel(name = "行政区划编码")
    private String addvcd;

    /**
     * 登陆密码
     */
    @Excel(name = "登陆密码")
    private String password;

    /**
     * 机构联系电话
     */
    @Excel(name = "机构联系电话")
    private String tel;

    /**
     * 上级机构id
     */
    @Excel(name = "上级机构id")
    private Long parentId;

    /**
     * 删除标记 0.未删除 1.已删除
     */
    @Excel(name = "删除标记 0.未删除 1.已删除")
    private Long isDeleted;

    public Map<String, String> getAddress() {
        return address;
    }

    public void setAddress(Map<String, String> address) {
        this.address = address;
    }

    public Long getParentLevelId() {
        return parentLevelId;
    }

    public void setParentLevelId(Long parentLevelId) {
        this.parentLevelId = parentLevelId;
    }

    public String getRandom() {
        return random;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public List<SysMechanism> getChildren() {
        return children;
    }

    public void setChildren(List<SysMechanism> children) {
        this.children = children;
    }

    public String getMechanismCode() {
        return mechanismCode;
    }

    public void setMechanismCode(String mechanismCode) {
        this.mechanismCode = mechanismCode;
    }

    public String getMechanismName() {
        return mechanismName;
    }

    public void setMechanismName(String mechanismName) {
        this.mechanismName = mechanismName;
    }

    public String getParentMechanismName() {
        return parentMechanismName;
    }

    public void setParentMechanismName(String parentMechanismName) {
        this.parentMechanismName = parentMechanismName;
    }

    public Long getLevelId() {
        return levelId;
    }

    public void setLevelId(Long levelId) {
        this.levelId = levelId;

        Map<String,String> map = new HashMap<>();
        if (this.levelId.equals(1L)) {
            map.put("type","");
            map.put("label","一级");
        } else if (this.levelId.equals(2L)) {
            map.put("type","success");
            map.put("label","二级");
        } else if (this.levelId.equals(3L)) {
            map.put("type","danger");
            map.put("label","三级");
        } else {
            map.put("type","warning");
            map.put("label","四级");
        }
        setMap(map);

    }

    public Map<String, String> getMap() {
        return map;
    }

    public void setMap(Map<String, String> map) {
        this.map = map;
    }

    public String getLevelName() {
        return levelName;
    }

    public void setLevelName(String levelName) {
        this.levelName = levelName;
    }

    public String getRegion() {
        return region;
    }

    public void setRegion(String region) {
        this.region = region;
    }

    public String getAddvcd() {
        return addvcd;
    }

    public void setAddvcd(String addvcd) {
        this.addvcd = addvcd;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getTel() {
        return tel;
    }

    public void setTel(String tel) {
        this.tel = tel;
    }

    public Long getParentId() {
        return parentId;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    public Long getIsDeleted() {
        return isDeleted;
    }

    public void setIsDeleted(Long isDeleted) {
        this.isDeleted = isDeleted;
    }

    @Override
    public String toString() {
        return "SysMechanism{" +
                "id=" + id +
                ", mechanismCode='" + mechanismCode + '\'' +
                ", mechanismName='" + mechanismName + '\'' +
                ", parentMechanismName='" + parentMechanismName + '\'' +
                ", levelId=" + levelId +
                ", levelName='" + levelName + '\'' +
                ", region='" + region + '\'' +
                ", addvcd='" + addvcd + '\'' +
                ", password='" + password + '\'' +
                ", tel='" + tel + '\'' +
                ", parentId=" + parentId +
                ", isDeleted=" + isDeleted +
                '}';
    }
}
